let l = [("Don",435.);("Nut",75.);("Toto",42.)];;


let compare a b = if a = b then 0 else if a < b then -1 else 1;;

let rec find name x = 
  match x with
      []-> failwith "Utilisateur non trouve"
    | (x,y)::_ when (String.lowercase x) = (String.lowercase name) -> y
    | _::l -> find name l;;

find "Toto" l;;


let rec add (user, v) lst =
  match lst with
      []-> (user, v)::[]
    | (a,b)::l when ( compare (String.lowercase user) (String.lowercase a)) = 0 -> (a,b)::l
    | (a,b)::l->if (compare (String.lowercase user) (String.lowercase a)) = 1
      then (a,b)::add (user, v) l
      else (a,b)::(user,v)::l;;

add ("ToTO", 4352.) l;;

let rec delete user lst =
  match lst with
      [] -> []
    | (a,b)::l when ( compare (String.lowercase user) (String.lowercase a)) = 0 -> l
    | (a,b)::l->if (compare (String.lowercase user) (String.lowercase a)) = 1
      then (a,b)::delete user l
      else (a,b)::l;;

delete "Tonio" l;;
